package validationTestSuite.tests
{
	import com.google.code.flexmetavalidator.metavalidation.MetaValidator;
	
	import org.flexunit.Assert;
	import org.flexunit.asserts.assertFalse;
	import org.flexunit.asserts.assertTrue;
	
	import validationTestSuite.tests.vo.NotNullObject;
	import validationTestSuite.tests.vo.NotZeroObject;
	
	public class NotZeroTest extends MetaValidatorTest
	{
		public function NotZeroTest()
		{
			super();
		}
		
		[Test]
		public function testString():void
		{
			var object : NotZeroObject = new NotZeroObject();
			object.varString = null;
			var testResult : Boolean = validator.validate(object);
			assertTrue(testResult);
			
			object.varString = "12";
			testResult = validator.validate(object);
			assertTrue(testResult);
			
			object.varString = "ABC";
			testResult = validator.validate(object);
			assertTrue(testResult);
			
			object.varString = "0";
			testResult = validator.validate(object);
			assertFalse(testResult);			
			
			for each (var errStr : String in validator.errors) {trace(errStr)}
		}
		
		[Test]
		public function testNumber():void
		{
			var object : NotZeroObject = new NotZeroObject();
			var testResult : Boolean = validator.validate(object);
			assertTrue(testResult);

			object.varNumber = NaN;
			testResult = validator.validate(object);
			assertTrue(testResult);
			
			object.varNumber = 99;
			testResult = validator.validate(object);
			assertTrue(testResult);
			
			object.varNumber = 0;
			testResult = validator.validate(object);
			assertFalse(testResult);			
			
			for each (var errStr : String in validator.errors) {trace(errStr)}
		}
		
	}
}